package moe.hotk

import moe.hotk.common._
import moe.hotk.entity._
import moe.hotk.repository._
import org.springframework.boot._
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.system.ApplicationPidFileWriter
import org.springframework.context.annotation.Bean

@SpringBootApplication
class Application {

  @Bean
  def initializeTruths(): CommandLineRunner = { _: Array[String] =>
    Truths create Truth(title = "The First Principle", content = "H-O-T-K")
    Truths create Truth(title = "The Second Principle", content = "En Taro God-H")
  }

}

object Application {

  def main(args: Array[String]) {
    new SpringApplication(classOf[Application]).
      withSideEffect(_ addListeners new ApplicationPidFileWriter).
      run(args: _*)
  }

}
